// 错误码汇总
// 可以根据错误类型进行定义，
// 例如，将参数错误定义为 4001，
// 将数据库错误定义为 5001，
// 将网络错误定义为 6001 等。

module.exports = {
    paramsError: {
        code: 422,
        message: '参数错误'
    },
    paramsNull: {
        code: 421,
        message: '参数为空'
    },
    emailExists: {
        code: 409,
        message: '邮箱已经存在'
    },
    passwordError: {
        code: 4001,
        message: '密码错误'
    },
    userNotExist: {
        code: 4002,
        message: '用户不存在'
    },
    authorizationRequired: {
        code: 401,
        message: '需要进行身份验证'
    },
    invalidToken: {
        code: 402,
        message: '需要进行身份验证'
    },
    updateFail: {
        code: 423,
        message: '更新失败'
    },
    followFail: {
        code: 424,
        message: '关注失败'
    },
    unfollowFail: {
        code: 425,
        message: '取消关注失败'
    },
    hadFollowed: {
        code: 426,
        message: '你已经关注了该用户'
    },
    articleExists: {
        code: 427,
        message: '文章已存在'
    },
    registerFailed: {
        code: 428,
        message: '注册失败'
    },
    createArticleFailed: {
        code: 428,
        // 哎呀！出了问题。请稍后再试。
        message: '创建文章失败'
    },
    notFoundAuthor: {
        code: 429,
        message: '未找到作者'
    },
    queryError: {
        code: 430,
        message: '查询失败'
    },
    notFoundAuthorArticle: {
        code: 431,
        message: '用户不存在或用户文章不存在'
    },
    deleteArticleFail: {
        code: 432,
        message: '文章删除失败'
    },
    updateArticleFail: {
        code: 441,
        message: '文章更新失败'
    },
    getTagListFail: {
        code: 433,
        message: '获取标签列表失败'
    },
    articleNotFound: {
        code: 434,
        message: '文章未找到'
    },
    articleAleadyFavorited: {
        code: 435,
        message: '文章已经收藏'
    },
    articleNotFavorited: {
        code: 436,
        message: '文章未收藏'
    },
    articleFavoritedFail: {
        code: 437,
        message: '收藏失败'
    },
    articleUnFavoritedFail: {
        code: 438,
        message: '取消收藏失败'
    },
    createCommentFail: {
        code: 439,
        message: '添加评论失败'
    },
    getCommentFail: {
        code: 440,
        message: '查询评论失败'
    },
    deleteCommentFail: {
        code: 442,
        message: '删除评论失败'
    },
    notFoundComment: {
        code: 443,
        message: '评论未找到'
    },
}